package model;

import java.util.ArrayList;
	
public class SpecialOrderContainer {

	private ArrayList<SpecialOrder> specialList;
	private static SpecialOrderContainer specialOrderContainer = null;
	
	private SpecialOrderContainer() {
		specialList = new ArrayList<SpecialOrder>();
	}
	
	public static SpecialOrderContainer getInstance(){
		if(specialOrderContainer == null){
			specialOrderContainer = new SpecialOrderContainer();
		}
		return specialOrderContainer;
	}

	public boolean addSpecialOrder(SpecialOrder specialOrder) {
		return specialList.add(specialOrder);
	}

	public boolean removeSpecialOrder(SpecialOrder specialOrder) {
		return specialList.remove(specialOrder);
	}
	
	public SpecialOrder findSpecialOrder(int id){
		for(SpecialOrder specialOrder : specialList){
			if(specialOrder.getSpecialOrderId() == id){
				return specialOrder;
			}
		}
		return null;
	}

	public ArrayList<String> getSpecialOrders(int id){
		ArrayList<String> al = new ArrayList<String>();
		for(SpecialOrder specialOrder : specialList){
			if(specialOrder.getCustomerId() == id){
				al.add(String.valueOf(specialOrder.getSpecialOrderId()));
			}
		}
		return al;
	}

}
